/**
 * 应用
 **/
//主列表点击事件
//主列表点击事件
var baselocation = "";
mui.init();


//mui('body').on('tap', 'a', function () {
//    var webview_style = {
//        popGesture: "close"
//    };
//    var aniShow = "pop-in";
//    var id = this.getAttribute('href');
//    var href = this.href.replace('file://', '');
//    if (id.indexOf('#') != -1) return;
//    mui.openWindow({
//        id: id,
//        url: baselocation + href,
//        styles: webview_style,
//        show: {
//            aniShow: aniShow
//        },
//        waiting: {
//            autoShow: false
//        }
//    });

//});

function DateFormat(jsondate) {
    jsondate = jsondate.replace("/Date(", "").replace(")/", "");
    if (jsondate.indexOf("+") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("+"));
    }
    else if (jsondate.indexOf("-") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("-"));
    }

    var date = new Date(parseInt(jsondate, 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var currentHours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var currentMinutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    //return date.getFullYear() + "-" + month + "-" + currentDate;
    return date.getFullYear() + "-" + month + "-" + currentDate + " " + currentHours + ":" + currentMinutes;
}
function DateFormat2(jsondate) {
    jsondate = jsondate.replace("/Date(", "").replace(")/", "");
    if (jsondate.indexOf("+") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("+"));
    }
    else if (jsondate.indexOf("-") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("-"));
    }

    var date = new Date(parseInt(jsondate, 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var currentHours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var currentMinutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    return month + "/" + currentDate + " " + currentHours + ":" + currentMinutes;
}
function DateFormat3(jsondate) {
    jsondate = jsondate.replace("/Date(", "").replace(")/", "");
    if (jsondate.indexOf("+") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("+"));
    }
    else if (jsondate.indexOf("-") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("-"));
    }

    var date = new Date(parseInt(jsondate, 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var currentHours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var currentMinutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    return month + "/" + currentDate;
}

function openw(href) {
    var webview_style = {
        popGesture: "close"
    };
    var aniShow = "pop-in";
    if (href == null || href == "#") return;
    mui.openWindow({
        id: href,
        url: baselocation + href,
        styles: webview_style,
        show: {
            aniShow: aniShow
        },
        waiting: {
            autoShow: false
        }
    });
}
